/**
 * @param {number[]} balance
 */
 var Bank = function(balance) {
  this.balance = balance
};

/** 
* @param {number} account1 
* @param {number} account2 
* @param {number} money
* @return {boolean}
*/
Bank.prototype.transfer = function(account1, account2, money) {
  const { balance } = this
  if(account1 > balance.length || account2 > balance.length){
      return false
  }
  if(balance[account1-1] >= money){
      balance[account1-1] -= money
      balance[account2-1] += money
      return true
  }
  return false
};

/** 
* @param {number} account 
* @param {number} money
* @return {boolean}
*/
Bank.prototype.deposit = function(account, money) {
  const { balance } = this
  if(account > balance.length) return false
  balance[account-1] += money
  return true
};

/** 
* @param {number} account 
* @param {number} money
* @return {boolean}
*/
Bank.prototype.withdraw = function(account, money) {
  const { balance } = this
  if(account <= balance.length && balance[account-1] >= money){
      balance[account-1] -= money
      return true
  }
  return false;
};

/**
* Your Bank object will be instantiated and called as such:
* var obj = new Bank(balance)
* var param_1 = obj.transfer(account1,account2,money)
* var param_2 = obj.deposit(account,money)
* var param_3 = obj.withdraw(account,money)
*/